
package com.xlf.service.blog.test.config;

import com.xlf.service.blog.test.UpdateArticleViewTask;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;

import java.util.Date;


/**
 * 定时任务配置
 */
@Configuration
@Data
@Slf4j
public class TaskConfig implements SchedulingConfigurer {


    @Autowired
    UpdateArticleViewTask updateArticleViewTask;


    @Override
    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
        log.info("--- 任务注册开始 ---");
        taskRegistrar.addCronTask(updateArticleViewTask,"0 0 5 * * ?");
        log.info("--- 任务注册结束 ---");
    }
}
